<?php



/**
 * This class defines the structure of the 'players' table.
 *
 *
 *
 * This map class is used by Propel to do runtime db structure discovery.
 * For example, the createSelectSql() method checks the type of a given column used in an
 * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
 * (i.e. if it's a text column type).
 *
 * @package    propel.generator.nawragon.map
 */
class PlayersTableMap extends TableMap
{

    /**
     * The (dot-path) name of this class
     */
    const CLASS_NAME = 'nawragon.map.PlayersTableMap';

    /**
     * Initialize the table attributes, columns and validators
     * Relations are not initialized by this method since they are lazy loaded
     *
     * @return void
     * @throws PropelException
     */
    public function initialize()
    {
        // attributes
        $this->setName('players');
        $this->setPhpName('Players');
        $this->setClassname('Players');
        $this->setPackage('nawragon');
        $this->setUseIdGenerator(true);
        // columns
        $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
        $this->addForeignPrimaryKey('game_id', 'GameId', 'INTEGER' , 'games', 'id', true, null, null);
        $this->addForeignKey('user_id', 'UserId', 'INTEGER', 'users', 'id', true, null, null);
        $this->addForeignKey('character_id', 'CharacterId', 'INTEGER', 'characters', 'id', true, null, null);
        $this->addForeignKey('state_def_id', 'StateDefId', 'INTEGER', 'state_defs', 'id', true, null, null);
        $this->addColumn('active', 'Active', 'INTEGER', true, null, 1);
        // validators
    } // initialize()

    /**
     * Build the RelationMap objects for this table relationships
     */
    public function buildRelations()
    {
        $this->addRelation('Users', 'Users', RelationMap::MANY_TO_ONE, array('user_id' => 'id', ), 'RESTRICT', 'RESTRICT');
        $this->addRelation('Characters', 'Characters', RelationMap::MANY_TO_ONE, array('character_id' => 'id', ), 'RESTRICT', 'RESTRICT');
        $this->addRelation('Games', 'Games', RelationMap::MANY_TO_ONE, array('game_id' => 'id', ), 'RESTRICT', 'RESTRICT');
        $this->addRelation('StateDefs', 'StateDefs', RelationMap::MANY_TO_ONE, array('state_def_id' => 'id', ), 'RESTRICT', 'RESTRICT');
        $this->addRelation('ProvinceHistories', 'ProvinceHistories', RelationMap::ONE_TO_MANY, array('id' => 'player_id', ), 'RESTRICT', 'RESTRICT', 'ProvinceHistoriess');
        $this->addRelation('Provinces', 'Provinces', RelationMap::ONE_TO_MANY, array('id' => 'player_id', 'game_id' => 'game_id', ), 'RESTRICT', 'RESTRICT', 'Provincess');
    } // buildRelations()

} // PlayersTableMap
